package edu.cmu.javadb.plan.condition;

public class Path {
	
	private String [] path;
	private String fullPath;
	
	public Path() {
		fullPath = "";
		this.path = new String[0];
	}
	
	public int getDepth() {
		return path.length;
	}
	
	public String getLevel(int i) {
		return path[i];
	}
		
	public Path(String path) {
		fullPath = path;
		if (path.equals("")) {
			this.path = new String[0];
		} else {
			this.path = path.split("\\.");
		}
	}
	
	public String toString() {
		return fullPath;
	}
	
	public String [] getPath() {
		return this.path;
	}

	public void setPath(String [] path) {
		this.path = path;
	}
	
	public boolean isRoot() {
		return path.length == 0;
	}
	
}
